﻿using DongleTest.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DongleTest
{
    public partial class PortSetting : Form
    {
        public PortSetting()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Settings.Default.OpenPortTime = (int)this.numOpenPort.Value;
            Settings.Default.InitPortTime = (int)this.numInit.Value;
            Settings.Default.SearchTime = (int)this.numSearchTime.Value;
            Settings.Default.SearchTimes = (int)this.numSearchTimes.Value;
            Settings.Default.SearchCount = (sbyte)this.numSearchCount.Value;
            Settings.Default.NotifyTime = (int)this.numNotify.Value;
            Settings.Default.LinkTime = (int)this.numLinkTime.Value;
            Settings.Default.LinkTimes = (int)this.numLinkTimes.Value;
            Settings.Default.TestTime = (int)this.numTest.Value;
            Settings.Default.Rssi = (int)this.numRssi.Value;
            Settings.Default.ClosePortTime = (int)this.numClosePort.Value;
            Settings.Default.WaveTime =(int) this.numWave.Value;
            Settings.Default.Save();
            this.Close();
        }

        private void PortSetting_Load(object sender, EventArgs e)
        {
            this.numOpenPort.Value = Settings.Default.OpenPortTime;
            this.numInit.Value = Settings.Default.InitPortTime;
            this.numSearchTime.Value = Settings.Default.SearchTime;
            this.numSearchTimes.Value = Settings.Default.SearchTimes;
            this.numSearchCount.Value = Settings.Default.SearchCount;
            this.numNotify.Value = Settings.Default.NotifyTime;
            this.numLinkTime.Value = Settings.Default.LinkTime;
            this.numLinkTimes.Value = Settings.Default.LinkTimes;
            this.numTest.Value = Settings.Default.TestTime;
            this.numRssi.Value = Settings.Default.Rssi;
            this.numClosePort.Value = Settings.Default.ClosePortTime;
            this.numWave.Value = Settings.Default.WaveTime;
        }

    }
}
